package com.hyt.it.ogt.kq.service.gov.feign.tps;

import com.hyt.common.apiInfor.ApiResponse;
import com.hyt.it.ogt.kq.service.gov.model.vo.obs.HuaweiObsCopyObjectResultVO;
import com.hyt.it.ogt.kq.service.gov.model.vo.obs.HuaweiObsObjectMetaDataVO;
import com.hyt.loginfo.config.OAuth2FeignRequestConfig;
import com.hyt.model.tps.vo.Bucket;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 第三方微服务（tps）Feign客户端
 */
@FeignClient(name="it-ogt-webcommon",contextId = "gov-it-ogt-webcommon",fallback = GovTpsClientHystrix.class, configuration = OAuth2FeignRequestConfig.class)
public interface GovTpsClient {

	/**
	 * 压缩腾讯云COS图片文件，并存储至指定路径
	 * @param officeId 机构id
	 * @param key 待压缩图片文件绝对路径
	 * @param targetPath 压缩后的图片存储的路径
	 * @return 压缩图片结果
	 */
	@RequestMapping(value = "/bucket/compressTencentCosPhoto", method = RequestMethod.POST)
	ApiResponse<String> compressTencentCosPhoto(@RequestParam String officeId, @RequestParam String key,
												@RequestParam String targetPath);

	/**
	 * 上传压缩腾讯云COS图片文件
	 * @param officeId 机构id
	 * @param path 上传路径
	 * @param bytes 图片文件byte数组
	 * @return 上传压缩图片结果
	 */
	@RequestMapping(value = "/bucket/uploadTencentCosCompressedPhoto", method = RequestMethod.PUT)
	ApiResponse<String> uploadTencentCosCompressedPhoto(@RequestParam String officeId, @RequestParam String path,
														@RequestBody byte[] bytes);

	/**
	 * 下载腾讯云COS文件
	 * @param officeId 机构id
	 * @param path 下载文件路径
	 * @return 下载文件的byte数组
	 */
	@RequestMapping(value = "/bucket/downloadTencentCosFile", method = RequestMethod.GET)
	ApiResponse<byte[]> downloadTencentCosFile(@RequestParam String officeId, @RequestParam String path);

	/**
	 * 下载华为云OBS文件
	 * @param officeId 机构id
	 * @param path 下载文件路径
	 * @return 下载文件的byte数组
	 */
	@RequestMapping(value = "/bucket/downloadHuaweiObsFile", method = RequestMethod.GET)
	ApiResponse<byte[]> downloadHuaweiObsFile(@RequestParam String officeId, @RequestParam String path);

	/**
	 * 获取腾讯云COS临时凭证
	 * @param officeId 机构id
	 * @return 腾讯云COS临时凭证
	 */
	@RequestMapping(value = "/bucket/getTencentCosTempCredential", method = RequestMethod.GET)
	ApiResponse<Bucket> getTencentCosTempCredential(@RequestParam String officeId);

	/**
	 * 复制华为云OBS对象
	 * @param officeId 机构id
	 * @param sourceObject 源对象
	 * @param destObject 目标对象
	 * @return 复制华为云OBS对象结果
	 */
	@PostMapping("/bucket/copyHuaweiObsObject")
	ApiResponse<HuaweiObsCopyObjectResultVO> copyHuaweiObsObject(@RequestParam String officeId,
																 @RequestParam String sourceObject,
																 @RequestParam String destObject);

	/**
	 *
	 * @param path
	 * @param charset
	 * @return
	 */
	@GetMapping("/bucket/getStringFromHuaweiObs")
	String getStringFromHuaweiObs(@RequestParam String path, @RequestParam String charset);

	/**
	 *	上传文件
	 * @param officeId
	 * @param path
	 * @param bytes
	 * @return
	 */
	@PutMapping("/bucket/uploadFileToHuawei")
	String uploadFileToHuawei(@RequestParam String officeId, @RequestParam String path,
							  @RequestBody byte[] bytes);

	@RequestMapping(value = "/wx/request/getBmQRCode", method = RequestMethod.GET)
	Object getBmQRCode(@RequestParam String officeId, @RequestParam String scene,@RequestParam String page, @RequestParam  Integer width);

	/**
	 * 获取华为云OBS对象属性
	 * @param officeId 机构id
	 * @param objectKey 对象objectKey
	 * @return 对象属性
	 */
	@RequestMapping(value = "/bucket/getHuaweiObsObjectMetaData", method = RequestMethod.GET)
	ApiResponse<HuaweiObsObjectMetaDataVO> getHuaweiObsObjectMetaData(@RequestParam String officeId, @RequestParam String objectKey);

	@PostMapping(value = "/zjw/Supplier/selectExam")
	String selectExam(@RequestParam String requestUrl, @RequestBody String json);

	@PostMapping(value = "/zjw/Supplier/selectKWAP")
	String selectKWAP(@RequestParam String requestUrl, @RequestBody String json);

	@PostMapping(value = "/zjw/Supplier/selectExamStudent")
	String selectExamStudent(@RequestParam String requestUrl, @RequestBody String json);

	@PostMapping(value = "/zjw/Supplier/insertExamStudentScore")
	String insertExamStudentScore(@RequestParam String requestUrl, @RequestBody String json);


}
